package com.myutils;

/**
 * @Author WaveHi
 * @Date 11/8/2021 下午 4:49
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 设计数组的工具类
 */
public class MyArrayUtils {

    public static <T> void copyArray(T[] srcArr,T[] destArr) {

        //判断数组是否是真的数组
        if(srcArr == null || destArr == null) {

            System.out.println("The length of srcArr and destArr is not right!");
            return;

        }

        //判断两个数组长度是否一致
        if(srcArr.length != destArr.length) {

            System.out.println("The length od srcArr and destArr is not right");
            return;

        }

        //循环复制
        for(int index = 0;index < srcArr.length;index++) {

            destArr[index] = srcArr[index];

        }

        System.out.println("Copy completed!");

    }

}
